package com.csl.testjetpack.repository

import android.content.Context
import androidx.lifecycle.LiveData
import com.csl.testjetpack.data.bean.RemoteInfo
import com.csl.testjetpack.data.db.RemoteDatabase

class RemoteRepository {
    companion object {
    // For Singleton instantiation
        @Volatile private var instance: RemoteRepository? = null
        fun getRemoteRepository(): RemoteRepository {
            return instance ?: synchronized(this) {
                instance ?: RemoteRepository().also { instance = it }
            }
        }
    }
    private constructor(){}

    suspend fun getRemotes(context: Context): LiveData<List<RemoteInfo>?>? {
        return RemoteDatabase.getDatabase(context).remoteDao?.allRemote
    }

}